//
//  GameOver.m
//  isMan
//
//  Created by Xing Lion on 11-6-20.
//  Copyright 2011年 InspurWorld. All rights reserved.
//

#import "GameOver.h"
#import "HelloWorldLayer.h"
#import "Sysmenu.h"
@implementation GameOver
+(id) scene
{
	// 'scene' is an autorelease object.
	CCScene *scene = [CCScene node];
	
	// 'layer' is an autorelease object.
	GameOver *layer = [GameOver node];
	
	// add layer as a child to scene
	[scene addChild: layer];
	
	// return the scene
	return scene;
}

- (id) init
{
	self = [super init];
	if (self)
	{
		CCSprite *sp = [CCSprite spriteWithFile:@"480_320.jpg"];
		sp.anchorPoint = ccp(0,0);
       
		[self addChild:sp z:0 tag:1];
//		
//        //		[MenuItemFont setFontName:@"Marker Felt"];
		[CCMenuItemFont setFontSize:25];
		
		CCMenuItem *retry = [CCMenuItemFont itemFromString:@"不服！再试一次？" target:self selector:@selector(Retry:)];
        
		CCMenuItem *gomenu = [CCMenuItemFont itemFromString:@"菜单" target:self selector:@selector(goMenu:)];
        
		
		CCMenu *mn = [CCMenu menuWithItems:retry, gomenu, nil];
		[mn alignItemsVertically];
		
		[self addChild:mn z:1 tag:2];
        
	}
	
	return self;
}


- (void) Retry:(id) sender
{
	CCScene *sc = [CCScene node];
	[sc addChild:[HelloWorldLayer node]];
	
	[[CCDirector sharedDirector] replaceScene: sc];
    
    
}

- (void) goMenu:(id) sender
{

    CCScene *sc = [CCScene node];
	[sc addChild:[Sysmenu node]];
	
	[[CCDirector sharedDirector] replaceScene: sc];
}



- (void) dealloc
{
	[super dealloc];
}

-(void) setresulTime:(float)time
{

    CGSize s = [[CCDirector sharedDirector] winSize];
    if (time <= 5.0) 
    {
        CCLabelTTF* label = [CCLabelTTF labelWithString:@"您这也太快了，这么几下就射了～" fontName:@"Arial" fontSize:25];
        [self addChild: label z:1];
        [label setPosition: ccp(s.width/2, s.height-50)];
    }
    else if(time > 5.0 && time <= 15.0)
    {
        CCLabelTTF* label = [CCLabelTTF labelWithString:@"小羊可以嘛～能不能再持久一点？" fontName:@"Arial" fontSize:25];
        [self addChild: label z:1];
        [label setPosition: ccp(s.width/2, s.height-50)];
    }
    else if (time > 15.0 && time <= 20.0)
    {
        CCLabelTTF* label = [CCLabelTTF labelWithString:@"你和战神的区别就是你少捅了一下！" fontName:@"Arial" fontSize:25];
        [self addChild: label z:1];
        [label setPosition: ccp(s.width/2, s.height-50)];
    }
    else if (time > 20.0 && time <= 30.0)
    {
        CCLabelTTF* label = [CCLabelTTF labelWithString:@"你是我的神～再来一次嘛～" fontName:@"Arial" fontSize:25];
        [self addChild: label z:1];
        [label setPosition: ccp(s.width/2, s.height-50)];
    }
    else
    {
        CCLabelTTF* label = [CCLabelTTF labelWithString:@"不要停～不要停～" fontName:@"Arial" fontSize:25];
        [self addChild: label z:1];
        [label setPosition: ccp(s.width/2, s.height-50)];
    }


}
@end
